﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Sharp.Domain.PlatformBoundedContext.MasterDataModule.Aggregates;
using Sharp.Domain.PlatformBoundedContext.OrgModule.Aggregates;
using Sharp.Domain.PlatformBoundedContext.UserModule.Aggregates;
using Sharp.Domain.Model;
using Sharp.Infrastructure;

namespace Sharp.Domain.PlatformBoundedContext.PersonModule.Aggregates
{
    /// <summary>
    /// 人员
    /// </summary>
    public partial class Person : AggregateRoot, IStandardEntity, IStandardState//, IFilter4Org
    {
        public Person()
        {
            Groups = new List<Group>();
            Users = new List<User>();
            OrgForBusinesses = new List<OrgForBusiness>();
        }
        /// <summary>
        /// 工号
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 全名
        /// </summary>
        [MaxLength(50)]
        public string FullName { get; set; }
        /// <summary>
        /// 姓名简拼
        /// </summary>
        [MaxLength(50)]
        public string Jianpin { get; set; }
        ///// <summary>
        ///// 性别
        ///// </summary>
        //[ForeignKey("GenderCode")]
        //public Gender Gender { get; set; }
        ///// <summary>
        ///// 民族
        ///// </summary>
        //[ForeignKey("NationCode")]
        //public Nation Nation { get; set; }
        /// <summary>
        /// 身份证
        /// </summary>
        [MaxLength(18)]
        public string IdCard { get; set; }
        /// <summary>
        /// 出生年月
        /// </summary>
        [MaxLength(8)]
        public string Birthday { get; set; }

        /// <summary>
        /// 户籍
        /// </summary>
        public string RegisteredResidence { get; set; }
        /// <summary>
        /// 年龄
        /// </summary>
        [NotMapped]
        public int? Age { get; set; }
        /// <summary>
        /// 手机
        /// </summary>
        public string Phone { get; set; }
        /// <summary>
        /// 传真
        /// </summary>
        public string Fax { get; set; }
        /// <summary>
        /// 电子邮件
        /// </summary>
        public string Email { get; set; }
        /// <summary>
        /// 家庭地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 紧急联系人
        /// </summary>
        public string UrgentContact { get; set; }
        /// <summary>
        /// 紧急联系电话
        /// </summary>
        public string UrgentPhone { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 添加日期
        /// </summary>
        public System.DateTime? CheckInTime { get; set; }
        /// <summary>
        /// 录入员的id
        /// </summary>
        public System.Guid? CheckInUserId { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        public System.DateTime? ModifiTime { get; set; }
        /// <summary>
        /// 修改数据的用户Id
        /// </summary>
        public System.Guid? ModifiedUserId { get; set; }
        /// <summary>
        /// 实体状态
        /// </summary>
        public EntityStateOperate EntityState { get; set; }
        /// <summary>
        /// 所属组织Id
        /// </summary>
        public System.Guid? OrgId { get; set; }
        /// <summary>
        /// 所属组织
        /// </summary>
        public virtual Org Org { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        public virtual ICollection<User> Users { get; set; }
        /// <summary>
        /// 员工的组
        /// </summary>
        public virtual ICollection<Group> Groups { get; set; }

        /// <summary>
        /// 业务组织结构
        /// </summary>
        public virtual ICollection<OrgForBusiness> OrgForBusinesses { get; set; }

        public string NationCode { get; set; }

        public string GenderCode { get; set; }

    }
}